<!doctype html>
<html class="no-js">
<head>
<% include("/common/admin_head.html",{title: '添加/编辑商品分类', validatorJS: true}){}%>
<%var isAdd = false;
  var isEdit = false;
  if(isEmpty(productCategory.id)){
	isAdd = true;
  }else{	
	isEdit = true;
  }%>
</head>
<body>
<!-- content start -->
<div class="admin-content">
  <div class="admin-content-body">
    <div class="am-cf app-padding-title">
      <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">商品管理</strong> / <small><%if(isAdd){%>添加商品分类<%}else{%>编辑商品分类<%}%></small>
      </div>
    </div>
	
    <hr data-am-widget="divider" class="am-divider am-divider-dashed am-margin-0" />
	  
    <form class="validator-form" action="<%if (isAdd){%>${base}/productCategory/save<%}else{%>${base}/productCategory/update<%}%>" method="post">
    <input type="hidden" name="productCategory.id" value="${productCategory.id!}" />
    <div class="am-form am-margin am-form-horizontal" >
      <div class="am-form-group am-form-group-sm">
        <label class="am-u-sm-4 am-u-md-3 am-text-right am-form-label">分类名称</label>
        <div class="am-u-sm-8 am-u-md-9">
          <input type="text" class="am-form-field" name="productCategory.name" value="${productCategory.name!}" required />
          <div class="am-text-warning am-margin-top-xs am-text-xs">${nameMessages!}</div>
        </div>
      </div>
      <div class="am-form-group am-form-group-sm">
        <label class="am-u-sm-4 am-u-md-3 am-text-right am-form-label">上级分类</label>
        <div class="am-u-sm-8 am-u-md-9">
          <%if(isAdd){%>
          <select name="parentId" data-am-selected="{btnWidth: '100%', maxHeight: '200px', btnSize: 'sm', btnStyle: 'secondary'}" placeholder="顶级分类">
            <option value=""></option>
            <%for(list in productCategoryTreeList){%>
            <option value="${list.id}">
			  <%if (list.level != 0){%>
			  <%for( i in range(0,list.level)){%>--<%}%>
			  <%}%>
			  ${list.name}
			</option>
            <%}%>
          </select>
          <%}else{%>
          ${productCategory.parent.name!'顶级分类'}
          <%}%>
        </div>
      </div>
      <div class="am-form-group am-form-group-sm">
        <label class="am-u-sm-4 am-u-md-3 am-text-right am-form-label">排序</label>
        <div class="am-u-sm-8 am-u-md-9">
          <input type="number" class="am-form-field" name="productCategory.orderList" value="${productCategory.orderList!50}" placeholder="只允许输入零或正整数" min="0" max="1000" required />
          <div class="am-text-warning am-margin-top-xs am-text-xs">${orderListMessages!}</div>
        </div>
      </div>
      <div class="am-form-group am-form-group-sm">
        <label class="am-u-sm-4 am-u-md-3 am-text-right am-form-label">关键词</label>
        <div class="am-u-sm-8 am-u-md-9">
          <input type="text" class="am-form-field" name="productCategory.metaKeywords" value="${productCategory.metaKeywords!}" />
        </div>
      </div>
      <div class="am-form-group am-form-group-sm">
        <label class="am-u-sm-4 am-u-md-3 am-text-right am-form-label">页面描述</label>
        <div class="am-u-sm-8 am-u-md-9">
          <textarea rows="10" class="am-form-field" name="productCategory.metaDescription">${productCategory.metaDescription!}</textarea>
        </div>
      </div>
      <hr data-am-widget="divider" class="am-divider am-divider-dashed" />
      <div class="am-form-group am-form-group-sm">
        <div class="am-u-sm-8 am-u-sm-offset-4 am-u-md-9 am-u-md-offset-3">
          <button type="submit" class="am-btn am-btn-primary"><span class="am-icon-save">  保  存</span></button>
          <button type="button" class="am-btn am-btn-default" onclick="window.history.back(); return false;"><span class="am-icon-undo">  返  回</span></button>
        </div>
      </div>
    </div>
    </form>
  </div>
</div>
<!-- content end -->
</body>
</html>
